<?php namespace Common\Model;

use Hdphp\Model\Model;

//友情链接表
class Link extends Model{
	//定义模型
	protected $table = "link";
	//自动验证
	protected $validate=array(
		array('lname','required','名称不能为空',3,3),
		array('url','required','地址不能为空',3,3),
		array('url','http','地址必须为网址格式',3,3),
		array('sort','required','排序不能为空',3,3),
	);

	//添加
	public function store(){
		if ($this->create()) {
			if (!$this->error) {
				$this->add();
				return true;
			}
		}
		return false;
	}

	//编辑
	public function edit(){
		if ($this->create()) {
			if (!$this->error) {
				$this->save();
				return true;
			}
		}
		return false;
	}






}